package com.example.dao;

import com.example.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDao {
    @Select("select * from user where id = #{id}")
    User findById(Integer id);

    @Insert("insert into user values (null, #{name}, #{age}, #{gender}, #{phone})")
    Integer add(User user);

    @Delete("delete from user where id=#{id}")
    Integer delete(Integer id);

    @Select("select * from user")
    List<User> findAll();

    @Update("update user set gender = #{gender} where name = #{name}")
    Integer update(User user);

    @Insert("insert into user(id, name,age,gender,phone) values (#{id},#{name}, #{age}, #{gender}, #{phone})")
    Integer testAdd(User user);
}
